package com.tjw.ec.upms.api.feign.fallback;

import com.tjw.ec.common.core.util.Response;
import com.tjw.ec.upms.api.dto.RoleVO;
import com.tjw.ec.upms.api.feign.RemoteRoleService;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 远程调用异常处理 : 角色表,基本权限的集合。无上级与下级之分;
 *
 * @author T-junwen
 * @email t-junwen@foxmail.com
 * @date 2019-08-02 11:58:44
 */
@Slf4j
@Component
public class RemoteRoleServiceFallbackImpl implements RemoteRoleService {

    @Setter
    private Throwable cause;


    /**
     * @param userId
     * @Title: 根据用户id查询用户角色
     * @Param: [userId] 用户id
     * @return: com.tjw.ec.common.core.util.Response<java.util.List < com.tjw.ec.upms.api.dto.RoleVO>>
     * @Author: 田俊文
     * @Date: 2019/8/2 14:12
     * @Throws:
     */
    @Override
    public Response<List<RoleVO>> getRoleByUserId(String userId) {
        log.info("RemoteRoleServiceFallbackImpl.getRoleByUserId - 》根据用户id查询用户角色 -> feign接口错误！" );
        log.error(cause.getCause().getMessage());
        return Response.faile();
    }
}

